package thread;

/*
 * @author zzr
 * @date: 2025/03/31  17:42
 * @description:
 */
public class ThreadDemo26 {
    public static void main(String[] args) throws InterruptedException {
        Thread t0 = new Thread(() -> {
            System.out.println("0");
        });
        Thread t1 = new Thread(() -> {
            try {
                t0.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("1");

        });
        Thread t2 = new Thread(() -> {
            try {
                t1.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("2");
        });
        Thread t3 = new Thread(() -> {
            try {
                t2.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("3");
        });
        Thread t4 = new Thread(() -> {
            try {
                t3.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("4");
        });
        Thread t5 = new Thread(() -> {
            try {
                t4.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("5");
        });
        Thread t6 = new Thread(() -> {
            try {
                t5.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("6");
        });
        Thread t7 = new Thread(() -> {
            try {
                t6.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("7");
        });
        Thread t8 = new Thread(() -> {
            try {
                t7.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("8");
        });
        Thread t9 = new Thread(() -> {
            try {
                t8.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("9");
        });
        Thread t10 = new Thread(() -> {
            try {
                t9.join();
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("10");
        });
        t0.start();
        t1.start();
        t2.start();
        t3.start();
        t4.start();
        t5.start();
        t6.start();
        t7.start();
        t8.start();
        t9.start();
        t10.start();
        t10.join();
        System.out.println("ok");
    }
}
